package com.twu.biblioteca;

import java.util.ArrayList;
import java.util.Random;

/**
 * Created by Rob on 17/09/2014.
 */
public class User {
    String libraryCardNumberAsString;
    String name = null;
    String password = null;
    String email = null;
    int phoneNumber = 000000;
    public ArrayList moviesBorrowed;

    public User(String libraryCardNumberReference, String inputName, String inputPassword, String inputEmail, int inputPhoneNumber) {
        libraryCardNumberAsString = libraryCardNumberReference;
        name = inputName;
        password = inputPassword;
        email = inputEmail;
        phoneNumber = inputPhoneNumber;
        moviesBorrowed = new ArrayList();
    }

    public String getName() {
        return name;
    }

    public String getPassword(){
        return password;
    }

    public String getEmail(){
        return email;
    }

    public int getPhoneNumber(){
        return phoneNumber;
    }

    public String getLibraryCardNumber(){
        return libraryCardNumberAsString;
    }

    public String generateLibraryCardNumber(){
        Random r = new Random();
        String first = "(" + r.nextInt((899)+100) + ")";
        int second = r.nextInt(8999)+1000;
        String libraryCardNumberAsString = first + "-" + second;
        System.out.println(libraryCardNumberAsString);
        return libraryCardNumberAsString;
    }

    public void addMovieToBorrowedList(Movie movieToAdd){
        moviesBorrowed.add(movieToAdd);
    }
}
